﻿using AJWPFAdmin.Core.GlobalEvents;
using AJWPFAdmin.Core.HardwareSDKS;
using AJWPFAdmin.Core.Models.EF.Tables;
using AJWPFAdmin.Services;
using AJWPFAdmin.Services.AppointAPI;
using Prism.Events;
using Prism.Mvvm;
using System.Windows;

namespace EntranceGuardManager.ViewModels
{
    public class MainWindowViewModel : BindableBase
    {
        private string _title;
        public string Title
        {
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }

        private string _apiDesc;
        public string APIDesc
        {
            get { return _apiDesc; }
            set { SetProperty(ref _apiDesc, value); }
        }

        private SystemUser _curUser;
        public SystemUser CurrentUser
        {
            get { return _curUser; }
            set { SetProperty(ref _curUser, value); }
        }

        private bool _menuOpen;
        public bool MenuOpen
        {
            get { return _menuOpen; }
            set { SetProperty(ref _menuOpen, value); }
        }

        private SideMenuNavEvent _sideMenuNavEvent;
        private AppointAPISvc _appointAPISvc;

        public MainWindowViewModel(IEventAggregator eventAggregator, AppointAPISvc appointAPISvc, SystemUserService sysUserSvc)
        {
            MenuOpen = true;
            _appointAPISvc = appointAPISvc;
            _curUser = sysUserSvc.CurrentUser;
            var version = Application.ResourceAssembly.GetName().Version;
            Title = $"清洁运输台账-管理端 {version}";
            APIDesc = appointAPISvc.API.KeyDescription;
            //_sideMenuNavEvent = eventAggregator.GetEvent<SideMenuNavEvent>();
            //_sideMenuNavEvent.Subscribe((name) =>
            //{
            //    MenuOpen = false;
            //});
        }
    }
}
